夸克分享[合].js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * 传参 ?type=url&params=../json/夸克分享.json@夸克分享[盘]
  3. * {"classes":[{"type_name":"花生十三","type_id":"8dd332256252"},{"type_name":"食谱","type_id":"78414690490e"},{"type_name":"体育","type_id":"25bf5b71edbb"}],"cookie":"__puus=0d26f820dbe87c2ff7689eca16d33dbdAATbA+y7U6E45kIqf3tUJD3ubw3yiLFUneh7o2z7qsn/vNtt13XnX5nq24o8c1PFNiaRXf9lCjyU8a8OHOwiWUwyB2awYMF3Q3KeegYcdEvy8ND7sRa0vlDQ1nPIWdR0BZD52AXBQj5UBIy0E2yknnBf+bzag4ivcZLepQskKRVGJ8tlB7jy8sgOem4zOP0cxKCMZLmwUeeaKFzdCnlhqj9+;__pus=69d93c40091ac35657fcdad30c901d8fAATxYe3kuhbmWR/i/UY5HxwQQPHPfx2Y/oEUXCA5LbTk2cvg8UqI6jwVZs1vlK34HoJ6KsjzHygZE3SbMoQVW2g6;__kp=c9e05ec0-8574-11ef-8fbe-77ecc2a14af3"}
  4. */
  5. globalThis.getxx = []
  6. var rule = {
  7. author: '嗷呜',
  8. title: '夸克分享[合]',
  9. host: 'https://drive.quark.cn',
  10. url: '/1/clouddrive/share/sharepage/token?pr=ucpro&fr=pc',
  11. filterable: 1,
  12. searchable: 2,
  13. quickSearch: 0,
  14. //params:'../json/夸克分享.json',
  15. params: 'http://127.0.0.1:9978/file/tvbox/js/json/夸克分享.json',
  16. headers: {
  17. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch',
  18. 'Referer': 'http://pan.quark.cn/',
  19. 'Content-Type': 'application/json',
  20. 'Cookie': ''
  21. },
  22. hikerListCol: "avatar",
  23. play_parse: true,
  24. lazy: $js.toString(() => {
  25. let url = input
  26. input = {
  27. url: url,
  28. parse: 0,
  29. header: rule.headers
  30. }
  31. }),
  32. 预处理: $js.toString(() => {
  33. let html = request(rule.params);
  34. let json = dealJson(html);
  35. rule_fetch_params.headers.Cookie = json.cookie
  36. rule.classes = json.classes;
  37. }),
  38. class_parse: $js.toString(() => {
  39. input = rule.classes;
  40. }),
  41. 一级: $js.toString(() => {
  42. let vodd = []
  43. let pdtoken = MY_CATE
  44. if (!pdtoken.includes('_wjj')) {
  45. getxx[0] = pdtoken
  46. let body = { "pwd_id": MY_CATE, "passcode": "" }
  47. let data = JSON.parse(fetch(input, {
  48. method: 'POST',
  49. headers: rule.headers,
  50. body: body
  51. }));
  52. let stoken = data.data.stoken
  53. getxx[1] = stoken
  54. let url = HOST+`/1/clouddrive/share/sharepage/detail?pr=ucpro&fr=pc&pwd_id=${MY_CATE}&stoken=${encodeURIComponent(stoken)}&pdir_fid=0&force=0&_page=${MY_PAGE}&_size=50&_fetch_banner=1&_fetch_share=1&_fetch_total=1&_sort=file_type:asc,updated_at:desc`
  55. let fid = JSON.parse(request(url, { headers: rule.headers })).data.list
  56. getxx[2] = fid[0].fid
  57. } else {
  58. getxx[2] = pdtoken.replace('_wjj', '')
  59. }
  60. let url = HOST+`/1/clouddrive/share/sharepage/detail?pr=ucpro&fr=pc&pwd_id=${getxx[0]}&stoken=${encodeURIComponent(getxx[1])}&pdir_fid=${getxx[2]}&force=0&_page=${MY_PAGE}&_size=50&_fetch_banner=1&_fetch_share=1&_fetch_total=1&_sort=file_type:asc,file_name:asc`
  61. getxx[3] = MY_PAGE
  62. let data1 = JSON.parse(fetch(url, { headers: rule.headers }))
  63. let data2 = data1.data.list;
  64. data2.forEach(it => {
  65. let pdsp = it.format_type;
  66. if (pdsp.includes('video')) {
  67. let enji = it.fid + "$" + it.share_fid_token + "$" + it.file_name
  68. vodd.push({
  69. vod_id: enji,
  70. vod_name: it.file_name,
  71. vod_pic: it.preview_url
  72. })
  73. } else if (pdsp === "") {
  74. vodd.push({
  75. vod_id: it.fid + '_wjj',
  76. vod_name: it.file_name,
  77. vod_pic: 'https://gitee.com/amg99/tvjson/raw/master/img/kkwjj.png',
  78. vod_tag: 'folder'
  79. })
  80. }
  81. });
  82. VODS = vodd
  83. }),
  84. 二级: $js.toString(() => {
  85. let fg = vod_id.split('$')
  86. let csurl = HOST+`/1/clouddrive/share/sharepage/detail?pr=ucpro&fr=pc&pwd_id=${getxx[0]}&stoken=${encodeURIComponent(getxx[1])}&pdir_fid=${getxx[2]}&force=0&_page=${getxx[3]}&_size=50&_fetch_banner=1&_fetch_share=1&_fetch_total=1&_sort=file_type:asc,file_name:asc`
  87. let csdata1 = JSON.parse(fetch(csurl, { headers: rule.headers })).data.list
  88. for (let i = 0; i < csdata1.length; i++) {
  89. if (csdata1[i].file_name === fg[2] && csdata1[i].share_fid_token !== fg[1]) {
  90. fg[1] = csdata1[i].share_fid_token
  91. break;
  92. }
  93. }
  94. let pdirdata = fetch(HOST+'/1/clouddrive/file/sort?pr=ucpro&fr=pc&uc_param_str&pdir_fid=0&_page=1&_size=50&_fetch_total=1&_fetch_sub_dirs=0&_sort=file_type:asc,file_name:asc', { headers: rule.headers })
  95. pdirdata = dealJson(pdirdata).data.list
  96. let pdir = ''
  97. for (let i = 0; i < pdirdata.length; i++) {
  98. if (pdirdata[i].file_name === '0000temp' || pdirdata[i].file_name === '来自:分享') {
  99. pdir = pdirdata[i].fid
  100. break;
  101. }
  102. }
  103. let body = { "fid_list": [fg[0]], "fid_token_list": [fg[1]], "to_pdir_fid": pdir, "pwd_id": getxx[0], "stoken": getxx[1], "pdir_fid": "0" }
  104. let task_id = JSON.parse(fetch(HOST+'/1/clouddrive/share/sharepage/save?pr=ucpro&fr=pc', {
  105. method: 'POST',
  106. headers: rule.headers,
  107. body: body
  108. })).data.task_id
  109. function syncDelay(milliseconds) {
  110. var start = new Date().getTime();
  111. var end = 0;
  112. while ((end - start) < milliseconds) {
  113. end = new Date().getTime();
  114. }
  115. }
  116. let save_as_top_fids = ''
  117. for (let i = 0; i < 10; i++) {
  118. let data = fetch(HOST+`/1/clouddrive/task?pr=ucpro&fr=pc&task_id=${task_id}&retry_index=${i}`, { headers: rule.headers });
  119. let dataa = JSON.parse(data).data.save_as.save_as_top_fids
  120. if ((dataa.length > 0)) {
  121. save_as_top_fids = dataa[0]
  122. break;
  123. }
  124. syncDelay(2000)
  125. }
  126. let play = []; let pname = [];
  127. function ddd() {
  128. let body1 = { "fid": save_as_top_fids, "resolutions": "normal,low,high,super,2k,4k", "supports": "fmp4,m3u8" }
  129. let pldata = fetch(HOST+'/1/clouddrive/file/v2/play?pr=ucpro&fr=pc', {
  130. method: 'POST',
  131. headers: rule.headers,
  132. body: body1
  133. });
  134. let pljson = JSON.parse(pldata).data.video_list
  135. pljson.forEach(it => {
  136. pname.push(it.video_info.width)
  137. play.push(fg[2] + '$' + it.video_info.url)
  138. })
  139. }
  140. for (let i = 0; i < 10; i++) {
  141. syncDelay(2000)
  142. try {
  143. ddd()
  144. break;
  145. } catch {
  146. play = []; pname = [];
  147. }
  148. }
  149. let body2 = { 'fids': [save_as_top_fids] }
  150. let pldata1 = fetch(HOST+'/1/clouddrive/file/download?pr=ucpro&fr=pc', {
  151. method: 'POST',
  152. headers: rule.headers,
  153. body: body2
  154. })
  155. VOD = {
  156. vod_play_from: pname.join('$$$'),
  157. vod_play_url: play.join('$$$')
  158. }
  159. }),
  160. }